import request from '@/utils/request'

export function queryPage(listQuery) {
  return request({
    url: 'role/page',
    method: 'post',
    params: {
      roleName: listQuery.roleName
    }
  })
}

export function queryAll() {
  return request({
    url: 'role/all',
    method: 'post'
  })
}

export function saveOrUpdate(temp) {
  return request({
    url: 'role/saveOrUpdate',
    method: 'post',
    data: temp
  })
}

export function queryInfo(id) {
  return request({
    url: 'role/' + id,
    method: 'get'
  })
}

export function deleteById(id) {
  return request({
    url: 'role/' + id,
    method: 'delete'
  })
}

export function bindResources(temp) {
  return request({
    url: 'role/bind/' + temp.name,
    method: 'post',
    data: temp.resources
  })
}

export function getBindResources(roleName) {
  return request({
    url: 'role/bind/' + roleName,
    method: 'get'
  })
}
